Currently, distributed storage systems increasingly use an erasure coding (EC, Erasure Coding) technology to store data. A principle of the erasure coding technology is to divide data into m data blocks, and perform parity coding on the m data blocks by using a redundancy algorithm, to generate k parity blocks, where the m data blocks and the k parity blocks are called one EC stripe. A data block or a parity block is also called an EC block, and each EC stripe is tolerable to a loss of k EC blocks.
To ensure storage reliability, a distributed storage system distributes m+k EC blocks of each EC stripe to m+k storage nodes for storage. In this way, even if a node is faulty, an EC block stored on the faulty node can be recovered according to data stored on another node. It may be understood that the distributed storage system using the EC technology is tolerable to concurrent faults of k storage nodes.
However, writing an EC block into a storage node requires a period of time. If a storage node in m+k storage nodes used to store an EC stripe is faulty when writing an EC block, a case in which a part of the storage nodes have an EC block of the EC stripe but the other part of the storage nodes do not have an EC block of the EC stripe occurs, causing storage inconsistency of the EC stripe. Therefore, storage consistency of the distributed storage system is poor.